{extend name="layout" /}@zhanghai.cc
{block name="content"}
<div class="content-wrapper">
    <div class="row">
        <div class="col-md-12 grid-margin stretch-card">
            <div class="card">
                <div class="card-body">
                    <h4 class="card-title">站点基本信息</h4>
                    <form class="layui-form forms-sample">
                        <div class="card">
                            <div class="card-body">
                                <div class="form-group row">
                                    <label  class="col-sm-3 col-form-label">站点名称</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="site[seo_title]" value="聚合支付" required lay-verify="required"  class="form-control" placeholder="聚合支付">
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label  class="col-sm-3 col-form-label">站点描述</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="site[seo_description]" value="聚合支付" required lay-verify="required"  class="form-control" placeholder="Caomao|草帽聚合|ThinkPHP5|onepay聚合支付">
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label  class="col-sm-3 col-form-label">站点关键词</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="site[seo_keywords]" value="聚合支付" required lay-verify="required"  class="form-control" placeholder="Caomao,ThinkPHP5,onepay聚合支付">
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label  class="col-sm-3 col-form-label">站点主域名</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="site[app_domain]" value="caomao.com" required lay-verify="required"  class="form-control" placeholder="caomao.com">
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label  class="col-sm-3 col-form-label">版权信息</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="site[app_copyright]" value="© 2018聚合支付. " required lay-verify="required"  class="form-control" placeholder="版权信息">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="card">
                            <div class="card-body">
                                <div class="form-group row">
                                    <label  class="col-sm-3 col-form-label">管理者名称</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="admin[username]" value="admin" required lay-verify="required"  class="form-control" placeholder="管理者名称">
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label  class="col-sm-3 col-form-label">管理者邮箱</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="admin[email]" value="admin@gaomikeji.com" required lay-verify="required"  class="form-control" placeholder="管理者邮箱">
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label  class="col-sm-3 col-form-label">管理密码</label>
                                    <div class="col-sm-9">
                                        <input type="password" name="admin[password]" value="" required lay-verify="required|password" id="password" class="form-control" placeholder="管理密码">
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label  class="col-sm-3 col-form-label">重复管理密码</label>
                                    <div class="col-sm-9">
                                        <input type="password" name="admin[repassword]" value="" required lay-verify="required|repassword" class="form-control" placeholder="管理密码">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label  class="col-sm-3 col-form-label"></label>
                            <div class="col-sm-9">
                                <a class="btn btn-outline-primary btn-large" href="{:url('install/Index/index')}">上一步</a>
                                <button type="button" class="btn btn-primary btn-submit-install btn-fw" lay-submit lay-filter="app-install-submit">下一步</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="pagejs"}
<script>
    layui.use(['form'], function(){
        let $ = layui.$
            ,form = layui.form;

        //数据验证
        form.verify({
            password: [/^[\S]{6,12}$/, "密码必须6到12位，且不能出现空格"],
            repassword: function(t) {
                if (t !== $("#password").val()) return "两次密码输入不一致"
            }
        });

        //监听提交
        form.on('submit(app-install-submit)', function(data){
            let field = data.field;
            console.log(field)
            //提交安装
            $.ajax({
                url:'{:url(\'install/Index/step1\')}',
                method:"POST",
                data:field,
                success:function (res) {
                    showToast(res);
                    if (res.code == 1){
                        setTimeout(function () {
                            location.href = '{:url(\'install/Index/step2\')}'
                        },1500)
                    }
                }
            });
        });
    });
</script>
{/block}